Class HCC.DT.HCC2HL72.OperUpd Extends Ens.DataTransformDTL [ DependsOn = (EnsLib.EDI.XML.Document, EnsLib.HL7.Message) ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='EnsLib.EDI.XML.Document' targetClass='EnsLib.HL7.Message' sourceDocType='POOR_IN200901UV:POOR_IN200901UV' targetDocType='2.5.1:BAR_P12' create='new' language='objectscript' >
<assign value='source.{id().extension}' property='target.{MSH:MessageControlID}' action='set' />
<assign value='source.{creationTime().value}' property='target.{MSH:DateTimeOfMessage.Time}' action='set' />
<assign value='"BAR"' property='target.{MSH:MessageType.MessageCode}' action='set' />
<assign value='"P12"' property='target.{MSH:MessageType.TriggerEvent}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().subject().patient().id.item(2).extension}' property='target.{PID:PatientID.IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().subject().patient().choice.patientPerson.id.item().extension}' property='target.{PID:PatientIdentifierList(1).IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().subject().patient().choice.patientPerson.name},"//s:item/s:part/@value")' property='target.{PID:PatientName(1)}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().subject().patient().choice.patientPerson.telecom},"//s:item/@value")' property='target.{PID:PhoneNumberHome(1).TelephoneNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().subject().patient().choice.patientPerson.administrativeGenderCode.displayName.value}' property='target.{PID:AdministrativeSex}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().subject().patient().choice.patientPerson.birthTime.value}' property='target.{PID:DateTimeofBirth.Time}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().subject().patient().choice.patientPerson.addr},"//s:item/s:part/@value")' property='target.{PID:PatientAddress(1)}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().pertinentInformation1().observationDx().code().displayName.value}' property='target.{DG1(1):DiagnosisType}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().pertinentInformation1().observationDx().value().code}' property='target.{DG1():DiagnosisCodeDG1.Identifier}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().pertinentInformation1().observationDx().value().displayName.value}' property='target.{DG1():DiagnosisCodeDG1.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().component2().choice.procedureRequest().code().code}' property='target.{PR1grp().PR1:ProcedureCode.Identifier}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().component2().choice.procedureRequest().code().displayName.value}' property='target.{PR1grp(1).PR1:ProcedureCode.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().component2().choice.procedureRequest().performer().choice.assignedEntity().id.item().extension}' property='target.{PR1grp().PR1:Surgeon(1).IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().component2().choice.procedureRequest().performer().choice.assignedEntity().choice.assignedPerson.name()},"//s:item/s:part/@value")' property='target.{PR1grp().PR1:Surgeon().FamilyName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().component2().choice.procedureRequest().performer().time.low.value}' property='target.{PR1grp().PR1:ProcedureDateTime.Time}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().component2().choice.procedureRequest().performer().choice.assignedEntity().representedOrganization.id().item().extension}' property='target.{PR1grp().PR1:Surgeon(1).AssigningAgencyorDepartment.Identifier}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().component2().choice.procedureRequest().performer().choice.assignedEntity().representedOrganization.name},"//s:item/s:part/@value")' property='target.{PR1grp().PR1:Surgeon().AssigningAgencyorDepartment.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().component2().choice.procedureRequest().performer().choice.assignedEntity().code.displayName.value}' property='target.{PR1grp().PR1:Surgeon().GivenName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().component2().choice.procedureRequest().priorityCode.displayName.value}' property='target.{PR1grp().PR1:ProcedurePriority}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().methodCode.item().displayName.value}' property='target.{PR1grp().PR1:AnesthesiaCode}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().id().item().extension}' property='target.{EVN:EventTypeCode}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().effectiveTime},"//s:low/@value")' property='target.{EVN:RecordedDateTime.Time}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().effectiveTime.low.value}' property='target.{EVN:EventOccurred.Time}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().code.displayName.value}' property='target.{EVN:EventReasonCode}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().author.assignedEntity().id.item().extension}' property='target.{EVN:OperatorID(1).IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().author.assignedEntity().choice.assignedPerson.name()},"//s:item/s:part/@value")' property='target.{EVN:OperatorID().FamilyName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().author.assignedEntity().representedOrganization.id().item().extension}' property='target.{EVN:OperatorID().AssigningAgencyorDepartment.Identifier}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().author.assignedEntity().representedOrganization.name},"//s:item/s:part/@value")' property='target.{EVN:OperatorID().AssigningAgencyorDepartment.Text}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().location().serviceDeliveryLocation().location.asLocatedEntityPartOf().location().name},"//s:item/s:part/@value")' property='target.{PV1:AssignedPatientLocation.Room}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().location().serviceDeliveryLocation().location.name},"//s:item/s:part/@value")' property='target.{PV1:AssignedPatientLocation.Bed}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().location().serviceDeliveryLocation().serviceProviderOrganization.name},"//s:item/s:part/@value")' property='target.{PV1:AssignedPatientLocation.Floor}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().location().serviceDeliveryLocation().serviceProviderOrganization.asOrganizationPartOf().wholeOrganization.name},"//s:item/s:part/@value")' property='target.{PV1:AssignedPatientLocation.Facility}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().verifier().assignedEntity().id.item().extension}' property='target.{PR1grp(1).ROL(1):RolePerson(1).IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().verifier().time.value}' property='target.{PR1grp().ROL():RolePerson().EffectiveDate.Time}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().verifier().assignedEntity().choice.assignedPerson.name()},"//s:item/s:part/@value")' property='target.{PR1grp().ROL():RolePerson().FamilyName}' action='set' />
</transform>
}

}
